from __future__ import annotations

from abc import ABC, abstractmethod
from typing import Optional, Set, Dict

from ...utils_module.logger import ObfuscationLogger


class BaseLanguageDependencyStrategy(ABC):
    """
    Base contract for language-specific dependency analysis helpers.
    """

    LANGUAGE: str = ''

    def __init__(self, logger: Optional[ObfuscationLogger] = None):
        self.logger = logger

    @property
    def language(self) -> str:
        return self.LANGUAGE

    @abstractmethod
    def extract_imports(self, content: str) -> Set[str]:
        """
        Extract import/module references from the provided source content.
        """

    def resolve_import(
        self,
        import_name: str,
        source_file: str,
        module_to_files: Dict[str, Set[str]],
    ) -> Set[str]:
        """
        Map an import reference to concrete file paths.
        """
        return set()

    def extract_module_name(self, file_path: str) -> Optional[str]:
        """
        Determine the module identifier the file belongs to.
        """
        return None
